import {
	getTypeList
} from "./config"

// 用户类型列表
const getUserTypeList = (typid) => {
	const tylist = getTypeList()
	let childs = []
	tylist.forEach((item, index) => {
		if (item.id === typid) {
			childs = item.childs
		}
	})
	return childs

}

// 用户类型选择
const getUserTypeSelectList = (currentItem) => {

	let iss = []


	const tylist = currentItem.childs
	tylist.forEach((item, index) => {

		let _data = {
			text: item.name,
			value: item.id,
		}

		let _childs = []
		item.childs.forEach((_item, i) => {
			_childs.push({
				text: _item.name,
				value: item.id + '-' + _item.id,
			})
		})

		if (_childs.length > 0) {
			_data.children = _childs
		}

		iss.push(_data)



	})
	

	return iss
}


export {
	getTypeList,
	getUserTypeSelectList
}